home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / BST_SystemDocs.lha / BeastV1 / Examples / BST_System / BST_Example3.txt < prev    next >
Encoding:
Text File  |  1996-03-31  |  2.4 KB  |  72 lines

  1.  
  2. Example3.c
  3. ==========
  4.  
  5. The function of this example is similiar to Example2, only now the
  6. example is based on inheritance.
  7.  
  8. The MATH_aClass will be the superclass of the others.
  9.  
  10. How it works
  11. ------------
  12.  
  13. One thing that is very different is the "math_a.instance" file.
  14. This represents the instance of the MATH_aClass superclass. If we
  15. define a class with MATH_aClass as superclass we must include this
  16. file in the instance. The math_xy_Instance uses besides the
  17. "math_a.instance" another item (LONG Y). The "math_a.instance" file
  18. is in this example stored in the current directory, the instances
  19. of public
  20.  
  21. The main() function has been slightly changed. Important is to _first_
  22. fully define the superclass (MATH_aClass). After this the other
  23. classes can be defined. The BST_MakeClass is replaced by the
  24. BST_MakeSubClass function.
  25. Now we only have to add the 'override' methods.
  26.  
  27. The classes
  28. -----------
  29.  
  30. The MATH_aClass class is the biggest class, this class is the superclass
  31. of the others.
  32.  
  33. mth_a_Init    - Just sets the instance A to 1.
  34. mth_a_InputX  - Builds a TagList containing a BTA_Y tag with the instance
  35.         A, this TagList is send to the method connected to the
  36.         OBM_OUTPUT method of this object.
  37. mth_a_OutputX - Just triggers the OBM_INPUT of this object.
  38. mth_a_SetAttr - The set attribute function..uhm... to set just the A instance
  39.         field.
  40.  
  41. The other classes are subclasses of the MATH_aClass and are therefore much
  42. smaller.
  43.  
  44. MATH_x2Class:
  45.  
  46. mth_x2_InputX - This is the only 'overiden' method, this because now the class
  47.         must 'output' the TagList with the A*X*X formula.
  48.         VERY IMPORTANT!: the MTHF_BREAK flag, this flag tells the beast
  49.         engine that _no more_ routines of _this_ method must be called.
  50.         If this flag isn't set the OBM_INPUT method routine of the
  51.         MATH_aClass is called again !!!... but sometimes this could be
  52.         just the thing you want. The methods of the subclasses are always
  53.         called first. In the new versions of the beast.library it will be
  54.         possible to queue the methods.
  55.  
  56. MATH_xClass:
  57.  
  58. mth_x_InputX  - The same story as for mth_x2_InputX, only now the formula is
  59.         A*X.
  60.  
  61. MATH_xyClass:
  62. This class has three method overides.
  63.  
  64. mth_xy_Init    - Set the Y instance to 0, please NOTE(!) that the MTHF_BREAK flag
  65.           is not there, this because the mth_a_Init is also neccesary to set
  66.          the A instance.
  67. mth_xy_InputY  - This method will calculate the result just as in BST_Example2.
  68. mth_xy_OutputY - The starting method as in BST_Example2.
  69.  
  70.  
  71.  
  72.